<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/10
 * Time: 11:46
 */

namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\DB;

class HxUsers extends Model
{
    protected $table='ivy_hx_users';
    public $timestamps = false;
    protected $primaryKey = 'id';

    public static function add($uid, $hx_user_info)
    {
        if(empty($uid) || empty($hx_user_info))
            return false;

        $model = new HxUsers();
        $model->uid = $uid;
        $model->hx_uuid = $hx_user_info['uuid'];
        $model->hx_username = $hx_user_info['username'];
        $model->hx_password = $hx_user_info['password'];
        $model->hx_nickname = $hx_user_info['nickname'];
        $model->hx_activated = ($hx_user_info['activated'] == true) ? 1 : 0;
        $model->reg_time = time();
        if(!$model->save())
            return false;
        return true;
    }

}
